import request from '@/utils/request'

// 账号登录
export const userAccountLogin = ({ account, password }) => {
  return request('/login', 'post', { account, password })
}
// 发送验证码
export const userMobileLoginMsg = (mobile) => {
  return request('/login/code', 'get', { mobile })
}
// 手机号登录
export const userMobileLogin = ({ mobile, code }) => {
  return request('/login/code', 'post', { mobile, code })
}
// qq登录
export const userQQLogin = (unionId, source = 1) => {
  return request('/login/social', 'post', { unionId, source })
}
// 发送qq绑定验证码
export const userQQBindCode = (mobile) => {
  return request('/login/social/code', 'get', { mobile })
}
// 立即绑定qq
export const userQQBindLogin = ({ unionId, mobile, code }) => {
  return request('/login/social/bind', 'post', { unionId, mobile, code })
}
// 校验用户名是否被注册
export const userAccountCheck = (account) => {
  return request('/register/check', 'get', { account })
}
// 注册时发送验证码
export const userQQPatchCode = (mobile) => {
  return request('/register/code', 'get', { mobile })
}
// 完善资料立即提交
export const userQQPatchLogin = ({ unionId, mobile, code, account, password }) => {
  return request(`/login/social/${unionId}/complement`, 'post', { unionId, mobile, code, account, password })
}
